<?php
/**
 * Model for the schools table
 */
class Schools extends CI_Model
{
	public function __construct()
	{
		$this->load->database();
	}
	
	/**
	 * @param $state_id The id of the state from the states table.
	 * @param $type     'high school' or 'college'
	 * 
	 * @return An array of high schools or colleges in a given state.
	 */
	public function select_by_state_id($state_id, $type)
	{
		$this->db->from('schools');
		$this->db->where('state_id', $state_id);
		$this->db->where('type', $type);
		$query = $this->db->get();
		return $query->result_array();
	}
}